package com.tjetc.utils;

import com.zhenzi.sms.ZhenziSmsClient;

import java.util.HashMap;
import java.util.Map;

public class ZhenziSms {

    public static void sendMessage(String phone,String code){
        try {
            final String apiUrl = "https://sms_developer.zhenzikj.com";
            final String appId = "113465";
            final String appSecret = "81ab0c57-21d7-4ec5-8c32-34c34c41815a";
            //调用榛子云api
            ZhenziSmsClient client = new ZhenziSmsClient(apiUrl,
                    appId, appSecret);
            //发送到注册手机
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("number", phone);
            params.put("templateId", "12163");
            String[] templateParams = new String[2];
            templateParams[0] = code;
            templateParams[1] = "5分钟";
            params.put("templateParams", templateParams);
            String result = client.send(params);
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
